<script lang="ts" setup>
import { h, reactive } from 'vue'
const formList = reactive<FormList>([
  {
    label: '单个年月日',
    prop: 'date',
    type: 'date',
    default: ({ value }) => {
      return h('div', { class: 'cell', style: { color: 'red' } }, value.text)
    },
    shortcuts: [
      {
        text: '今天',
        value: new Date()
      },
      {
        text: '昨天',
        value: () => {
          const date = new Date()
          date.setTime(date.getTime() - 3600 * 1000 * 24)
          return date
        }
      },
      {
        text: '一周前',
        value: () => {
          const date = new Date()
          date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
          return date
        }
      }
    ]
  }
])
const submitForm = (formData: any) => {
  console.log(formData)
}
</script>
<template>
  <XyAddForm isCard :formList="formList" @submit-form="submitForm" />
</template>
